<VirtualHost *:80>
	ServerName <%= domain %>
	<% if fetch(:domain_alias, false) %>
	ServerAlias <%= fetch(:domain_alias, "") %>
	<% end %>
	DocumentRoot /var/www/rails_apps/<%= application %>/current/public

	<directory "/var/www/rails_apps/<%= application %>/current/public">
    AllowOverride all
    Options -MultiViews
    Options FollowSymLinks
	</directory>
	RailsEnv <%= fetch(:rails_env, "production") %>
	LogLevel warn
  ErrorLog /var/www/rails_apps/<%= application %>/shared/log/error.log
  CustomLog /var/www/rails_apps/<%= application %>/shared/log/access.log combined

  #set far future expire date for static files
  #<FilesMatch "\.(ico|pdf|flv|jpe?g|png|gif|js|css|swf)$">
    #ExpiresActive On
    #ExpiresDefault "access plus 1 year"
  #</FilesMatch>
  
 	# Gzip/Deflate
	AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript application/javascript
	BrowserMatch ^Mozilla/4 gzip-only-text/html
	BrowserMatch ^Mozilla/4\.0[678] no-gzip
	BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

  RewriteEngine On 
  
  # Want to force default domain?
  <% if fetch(:force_default_domain, false) %>
  RewriteCond %{HTTP_HOST} !^<%= domain.gsub('.','\.') %>
  RewriteRule ^(.*)$ http://<%= domain %>$1 [R=permanent,L]
  <% end %>
  
  # Rewriting for Maintenance page
  RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
  RewriteCond %{SCRIPT_FILENAME} !maintenance.html
  RewriteRule ^.*$ /system/maintenance.html [L]
</VirtualHost>
